<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:replace="layout/header :: header(title=资源管理)">
<body class="gray-bg">
	
	<div id="infos">
		<div v-show="showList" class="row wrapper wrapper-content animated fadeInRight">
			<div class="col-sm-12">
				<div class="ibox">
					<div class="ibox-title">
						<h5>资源管理</h5>
					</div>
					<div class="ibox-content">
							<div class=" col-sm-2" sec:authorize="hasAuthority('admin_resource_list')">
								<input type="text" class="form-control" id="resourceName" @keyup.enter="query" placeholder="资源名称">
							</div>							
							<a sec:authorize="hasAuthority('admin_resource_list')" id="query" class="btn btn-info" @click="query"><i class="fa fa-search"></i>&nbsp;&nbsp;查询</a>&nbsp;&nbsp;
							<a sec:authorize="hasAuthority('admin_resource_save')" id= "add" class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;&nbsp;新增</a>&nbsp;&nbsp;
							<a sec:authorize="hasAuthority('admin_resource_update')" class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;&nbsp;修改</a>&nbsp;&nbsp;
							<a sec:authorize="hasAuthority('admin_resource_delete')" class="btn btn-danger" @click="del"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;删除</a>
						<br>
						<br>
						<div class="row row-lg">
							<div class="col-sm-12">
								<div class="table-responsive">
									<table id="infoList" ></table>			
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>			
		</div>
		
		<div v-show="!showList" class="row wrapper wrapper-content animated fadeInRight">
			<div class="col-sm-6 col-sm-offset-3">
				<div class="ibox">
					<div class="ibox-title">
						<h5>{{title}}</h5>
					</div>
					<div class="ibox-content">
					<form class="form-horizontal">
						<div class="form-group">
							<div class="col-sm-2 control-label">资源类型</div> 
							<div class="col-sm-10">
								<label class="radio-inline">
								  <input type="radio" name="resourceType" value="0" v-model="info.resourceType"/> 目录
								</label>
								<label class="radio-inline">
								  <input type="radio" name="resourceType" value="1" v-model="info.resourceType"/> 菜单
								</label>
								<label class="radio-inline">
								  <input type="radio" name="resourceType" value="2" v-model="info.resourceType"/> 按钮
								</label>
							</div>
						</div>
						<div class="form-group">
						   	<div class="col-sm-2 control-label">资源名称</div>
						   	<div class="col-sm-10">
						      <input type="text" class="form-control" v-model="info.resourceName" placeholder="菜单名称或按钮名称"/>
						    </div>
						</div>
						<div class="form-group">
							<div class="col-sm-2 control-label">所属资源</div>
						   	<div class="col-sm-10">
						       <input type="text" class="form-control" style="cursor:pointer;" v-model="info.parentName" @click="resInfoTree" readonly="readonly" placeholder="所属资源"/>
						    </div>
						</div>
						<div v-if="info.resourceType == 1 || info.resourceType == 2" class="form-group">
						   	<div class="col-sm-2 control-label">资源URL</div>
						   	<div class="col-sm-10">
						      <input type="text" class="form-control" v-model="info.resourceUrl" placeholder="资源URL"/>
						    </div>
						</div>
						<div v-if="info.resourceType == 1 || info.resourceType == 2" class="form-group">
						   	<div class="col-sm-2 control-label">权限标识</div>
						   	<div class="col-sm-10">
						      <input type="text" class="form-control" v-model="info.permissions" placeholder="多个权限用下划线分隔，如：user_list,user_create"/>
						    </div>
						</div>
						<div class="form-group">
						   	<div class="col-sm-2 control-label">所属层次</div>
						   	<div class="col-sm-10">
						      <input type="number" class="form-control" v-model="info.level" placeholder="所属层次"/>
						    </div>
						</div>
						<div class="form-group">
						   	<div class="col-sm-2 control-label">排序号</div>
						   	<div class="col-sm-10">
						      <input type="number" class="form-control" v-model="info.orderNum" placeholder="排序号"/>
						    </div>
						</div>
						<div class="form-group">
						   	<div class="col-sm-2 control-label">是否显示</div>
						   	<div class="col-sm-10">
						   		<select v-model="info.isHide" class="form-control">
                                	<option value="0">显示</option>
                                	<option value="1">隐藏</option>
                                </select>
						    </div>
						</div>
						<div v-if="info.resourceType != 2" class="form-group">
						   	<div class="col-sm-2 control-label">图标</div>
						   	<div class="col-sm-10">
						      <input type="text" class="form-control" v-model="info.icon" placeholder="菜单图标"/>
						    </div>
						</div>
						<div class="form-group">
							<div class="col-sm-2 control-label"></div>
							<div class="col-sm-10">
								<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>&nbsp;&nbsp;
								<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
							</div>
						</div>
					</form>
					</div>
				</div>
			</div>
		</div>
	
	<!-- 资源树 -->
	<div id="rescLayer" style="display: none;padding:10px;">
		<ul id="rescTree" class="ztree"></ul>
	</div>	
		
	<script th:src="@{/js/admin/sysresource.js}"></script>	
	</div>
		
</body>
</html>